import cv2
import numpy as np


def draw_circle(event, x, y, flags, param):
    if event == cv2.EVENT_LBUTTONDBLCLK:
        # 双击鼠标左键，画圆
        cv2.circle(img, (x, y), 60, (0, 0, 255), -1)


img = np.zeros((500, 500, 3), np.uint8)

# 设置窗口名
cv2.namedWindow('image')

# 设置鼠标点击事件的回调
cv2.setMouseCallback('image', draw_circle)

while(1):
    cv2.imshow('image', img)
    # 按q键退出
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# cv2.imshow('image',img)
# cv2.waitKey(0)
cv2.destroyAllWindows()
